Skip to content

Conversation

@l-Luna
Copy link

@l-Luna l-Luna commented Dec 11, 2024

Currently, making a test case requires a lot of work - a separate Language + FileType + ParserDefinition + ParsingTestCase, all of which are virtually identical between tests. This PR creates generic versions of each of these, so test cases can be defined just by:

  • A grammar file (possibly reused between tests)
  • A root rule to attempt to parse
  • A filename to compare

There's some complication around dynamically creating Languages, since IntelliJ enforces that each language uses a unique class & has a unique identifier. I use the shadowed org.jetbrains.org.objectweb.asm to generate a trivial subclass per grammar, which I think is fine to use for testing, but it might be worth shadowing it ourselves, or finding another way about it - ParsingTestCase does a lot of heavy lifting that would need to be redone though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants